package com.android.dumiaogou.adapt;

import android.widget.ImageView;

import com.android.dumiaogou.model.member.TeamListData;
import com.android.dumiaogou.utils.ObjectUtils;
import com.android.dumiaogou.R;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2016/8/10.
 */
public class listMineTeamAdapt extends BaseQuickAdapter<TeamListData.MineTuanData.MineTuandata, BaseViewHolder> {
    public listMineTeamAdapt(int layoutResId, List<TeamListData.MineTuanData.MineTuandata> data) {
        super(layoutResId, data);

    }


    @Override
    protected void convert(BaseViewHolder holder, TeamListData.MineTuanData.MineTuandata mineTuandata) {
        holder.setText(R.id.item_list_mine_tuan_title, mineTuandata.getName());
        holder.setText(R.id.item_list_mine_tuan_tuanshu, mineTuandata.getTeam_num() + "人团");
        holder.setText(R.id.item_list_mine_tuan_tuanzhuangtai, mineTuandata.getStatus_name());
        holder.setText(R.id.item_list_mine_tuan_totalmoney, "￥" + mineTuandata.getSell_price());
        ObjectUtils.photo(mContext, mineTuandata.getThumb(), (ImageView) holder.getView(R.id.item_list_mine_tuan_img));
        switch (mineTuandata.getStatus_common()) {
            case "1":
                if (mineTuandata.isIssue()) {
                    holder.setVisible(R.id.item_list_mine_tuan_dingdangdetail, true);
                    holder.setVisible(R.id.item_list_mine_tuan_pintuandetail, false);
                    holder.setVisible(R.id.item_list_mine_tuan_invaite, true);
                    holder.setVisible(R.id.item_list_mine_tuan_update, false);
                } else {
                    holder.setVisible(R.id.item_list_mine_tuan_dingdangdetail, false);
                    holder.setVisible(R.id.item_list_mine_tuan_pintuandetail, false);
                    holder.setVisible(R.id.item_list_mine_tuan_invaite, true);
                    holder.setVisible(R.id.item_list_mine_tuan_update, true);
                }
                break;
            case "2":
                holder.setVisible(R.id.item_list_mine_tuan_dingdangdetail, true);
                holder.setVisible(R.id.item_list_mine_tuan_pintuandetail, true);
                holder.setVisible(R.id.item_list_mine_tuan_invaite, false);
                holder.setVisible(R.id.item_list_mine_tuan_update, false);
                break;
            case "10":
                holder.setVisible(R.id.item_list_mine_tuan_dingdangdetail, true);
                holder.setVisible(R.id.item_list_mine_tuan_pintuandetail, true);
                holder.setVisible(R.id.item_list_mine_tuan_invaite, false);
                holder.setVisible(R.id.item_list_mine_tuan_update, false);
                break;
            default:
                holder.setVisible(R.id.item_list_mine_tuan_dingdangdetail, true);
                holder.setVisible(R.id.item_list_mine_tuan_pintuandetail, true);
                holder.setVisible(R.id.item_list_mine_tuan_invaite, false);
                holder.setVisible(R.id.item_list_mine_tuan_update, false);
                break;
        }
        holder.addOnClickListener(R.id.item_list_mine_tuan_invaite);
        holder.addOnClickListener(R.id.item_list_mine_tuan_update);
        holder.addOnClickListener(R.id.item_list_mine_tuan_dingdangdetail);
        holder.addOnClickListener(R.id.item_list_mine_tuan_pintuandetail);

    }


}
